import {useRoutes} from "react-router-dom";

import SystemRoutes from "./modules/system"
import DatasetRoutes from "./modules/dataset"
import BucketRoutes from "./modules/bucket"
import React from "react";
import {Lazy} from "@kordar/easyui-tpl";
import AppLayout from "../components/AppLayout";



const Login = React.lazy(() => import("../views/system/login") )
const Home = React.lazy(() => import("../views/system/home"))
const NotFound = React.lazy(() => import("../views/system/404"))

export default function Index() {
    return useRoutes([
        {
            path: '/',
            element: <AppLayout />,
            children: [
                {path: "", element: Lazy(<Home/>)},
                {path: "home", element: Lazy(<Home/>)}
            ]
        },
        {
            path: '/system',
            element: <AppLayout />,
            children: [
                ...SystemRoutes,
            ]
        },
        {
            path: '/dataset',
            element: <AppLayout />,
            children: [
                ...DatasetRoutes,
            ]
        },
        {
            path: '/bucket',
            element: <AppLayout />,
            children: [
                ...BucketRoutes,
            ]
        },
        {
            path: '/login',
            element: Lazy(<Login/>),
        },
        {
            path: '*',
            element: <AppLayout />,
            children: [
                {path: "*", element: Lazy(<NotFound/>)}
            ]
        }
    ])
}
